home *** CD-ROM | disk | FTP | other *** search
/ Developer Helper 1: Phil & Dave's Excellent CD / Excellent CD HFS.raw / Utilities / SEdit / Template.r < prev   
Text File  |  2022-08-05  |  14KB  |  522 lines

  1. /*
  2.  *  Templates for Sedit.
  3.  *  David Shayer, SQA Tools Team, Apple Computer Inc.
  4.  *  Copyright © 1988.
  5.  *
  6.  *  The MPW command to run to compile the resource file:
  7.     rez -o Template.rsrc -t rsrc -c RSED -a Template.r
  8.  *
  9.  *  Note that field names can only be 6 chars long.
  10.  *  Template names can be as long as desired.
  11.  */
  12.  
  13.  
  14. /* resource template type definition */
  15. type 'STMP'
  16. {
  17.     longint = $$CountOf(fields);    /* number of fields */
  18.     array fields
  19.     {
  20.         pString[6];                    /* field name        */
  21.         align word;
  22.         longint;                    /* field size        */
  23.     };
  24. };
  25.  
  26.  
  27. /*
  28.  *  Templates are used to format the data shown in the data windows.
  29.  *  Since disks are block devices, a template formats one block of data.
  30.  *  (A block is often 512 bytes, but can be other sizes - it varies from 
  31.  *  device to device.  So templates should not depend upon one block size.)
  32.  *  Templates are set up by the user (there are some supplied), and
  33.  *  are stored in resources, which are read in at launch.  The resource
  34.  *  name becomes the template name.  Names are not case sensitive.
  35.  *  There are some special names:
  36.  *    Default - the format to use if none is specified.  
  37.  *    Sense Check - the format to use for sense check error info
  38.  *    Inquiry - the format to use for scsi inquiry call data
  39.  *    Mode Sense - the format to use for scsi mode sense call data
  40.  *    Read Cap - the format to use for scsi read capacity call data
  41.  *    TIB - used to set up TIB's for custom scsi calls
  42.  *    6 Byte SCSI Cmd, 10 Byte SCSI Cmd, 12 Byte SCSI Cmd - used to
  43.  *              set up scsi command blocks for custom scsi calls
  44.  *    DCI - used to display data chaining instructions for custom scsi calls
  45.  *    ParamBlock - displays the SCSIReq param block to the SCSI atomic call
  46.  *  Note: the default template must be present, or Sedit won't run.  The
  47.  *  other templates listed above are called standard templates, Sedit
  48.  *  knows them by name, and will use them if they are present, or will
  49.  *  use the default template if it can't find them.  You can add your
  50.  *  own template resources, Sedit won't use them automatically but will
  51.  *  let you select them from the menu.  The other templates in this file
  52.  *  (Driver Map, Old Part Map, New Part Map) are for your convenience 
  53.  *  only, they are not required.  The standard templates names are stored
  54.  *  in a STR# resource if you wish to change their names.
  55.  *
  56.  *  Field name is trimmed to 6 chars.  Field name is not case sensitive.
  57.  *  Size must be between 0 and 16.
  58.  *  There are some special field names:
  59.  *    Skip - don't display this field, or, skip this much data.
  60.  *    Addr - replace this name with the address of this data
  61.  *           (the offset of the first byte of the field's data from
  62.  *           the beginning of the block)
  63.  *    Repeat - repeat the last x fields y times, where x is the loword
  64.  *           of Size and y is the hiword of Size.  If y is zero, it means
  65.  *           repeat the last x fields until you have displayed all the
  66.  *           data in the buffer.  You cannot nest repeats.
  67.  */
  68.  
  69. /* Resource Declarations*/
  70.  
  71. /* The default template is required by Sedit */
  72. resource 'STMP' (1, "Default") 
  73. {
  74.     {
  75.     "Addr",                            /* subst real addr for "Addr"*/
  76.     16,                                /* 16 bytes                    */
  77.     "Repeat",                        /* repeat until out of data */
  78.     0x00000001                        
  79.     }
  80. };
  81.  
  82. /* The following templates are standard templates, Sedit knows them by 
  83.    resource name, and will use them automatically if they are present */
  84. /* The following templates are straight out of the ANSI SCSI spec */
  85. resource 'STMP' (2, "Sense Check") 
  86. {
  87.     {
  88.     "Error",                        /* error class & error code    */
  89.     1,                                /* 1 byte                    */
  90.     "SegNum",                        /* segment number            */
  91.     1,                                /* 1 byte                    */
  92.     "SenKey",                        /* sense key (& bit codes)    */
  93.     1,                                /* 1 byte                    */
  94.     "Info",                            /* information bytes        */
  95.     4,                                /* 4 bytes                    */
  96.     "AddLen",                        /* additional sense length    */
  97.     1,                                /* 1 byte                    */
  98.     /* following is vendor unique */
  99.     "AddSen",                        /* additional sense bytes    */
  100.     11,                                /* 11 bytes                    */
  101.     "AddKey",                        /* additional sense key        */
  102.     1,                                /* 1 byte                    */
  103.     "AddSen",                        /* additional sense bytes    */
  104.     16,                                /* as many bytes as sent    */
  105.     "Repeat",                        /* repeat until out of data */
  106.     0x00000001                        
  107.     }
  108. };
  109.  
  110. resource 'STMP' (3, "Read Cap") 
  111. {
  112.     {
  113.     "Blocks",                        /* logical block address    */
  114.     4,                                /* 4 bytes                    */
  115.     "Size",                            /* block length                */
  116.     4                                /* 4 bytes                    */
  117.     }
  118. };
  119.  
  120. resource 'STMP' (4, "Inquiry") 
  121. {
  122.     {
  123.     "DevTyp",                        /* peripherial device type    */
  124.     1,                                /* 1 byte                    */
  125.     "Qualfy",                        /* device type qualifier    */
  126.     1,                                /* 1 byte                    */
  127.     "BitCod",                        /* ISO, ECMA, ANSI bit codes*/
  128.     1,                                /* 1 byte                    */
  129.     "Reserv",                        /* reserved                    */
  130.     1,                                /* 1 byte                    */
  131.     "AddLen",                        /* additional length        */
  132.     1,                                /* 1 byte                    */
  133.     /* following is vendor unique */
  134.     "Data",                            /* misc vendor data            */
  135.     3,                                /* 3 bytes                    */
  136.     "Mfg",                            /* mfg name                    */
  137.     8,                                /* 16 bytes                    */
  138.     "Prodct",                        /* product name                */
  139.     16,                                /* 8 more bytes                */
  140.     "DrvRev",                        /* drive revision level        */
  141.     4,                                /* 8 more bytes                */
  142.     "ROMRev",                        /* rom revision level        */
  143.     8,                                /* 8 more bytes                */
  144.     "Data",                            /* misc vendor data            */
  145.     16,                                /* as many bytes as sent    */
  146.     "Repeat",                        /* repeat until out of data */
  147.     0x00000001                        
  148.     }
  149. };
  150.  
  151. resource 'STMP' (5, "Mode Sense") 
  152. {
  153.     {
  154.     "SenLen",                        /* sense data length        */
  155.     1,                                /* 1 byte                    */
  156.     "Medium",                        /* medium type                */
  157.     1,                                /* 1 byte                    */
  158.     "Reserv",                        /* reserved                    */
  159.     1,                                /* 1 byte                    */
  160.     "DesLen",                        /* block descriptor length    */
  161.     1,                                /* 1 byte                    */
  162.     "DCode",                        /* density code                */
  163.     1,                                /* 1 byte                    */
  164.     "Blocks",                        /* number of blocks            */
  165.     3,                                /* 3 bytes                    */
  166.     "Reserv",                        /* resreved                    */
  167.     1,                                /* 1 byte                    */
  168.     "BlkLen",                        /* block length                */
  169.     3,                                /* 3 bytes                    */
  170.     "Vendor",                        /* vendor unique info        */
  171.     16,                                /* as many bytes as sent    */
  172.     "Repeat",                        /* repeat until out of data */
  173.     0x00000001                        
  174.     }
  175. };
  176.  
  177. /* The following templates are for formatting custom scsi commands.
  178.    These are also standard templates. */
  179. resource 'STMP' (6, "TIB") 
  180. {
  181.     {
  182.     "OpCode",                        /* TIB OpCode                */
  183.     2,                                /* 2 bytes                    */
  184.     "Param1",                        /* TIB parameter 1            */
  185.     4,                                /* 4 bytes                    */
  186.     "Param2",                        /* TIB parameter 2            */
  187.     4,                                /* 4 bytes                    */
  188.     "Repeat",                        /* repeat the previous 3 fields */
  189.     0x00000003                        /* repeat until out of data */
  190.     }
  191. };
  192.  
  193. resource 'STMP' (7, "6 Byte SCSI Cmd") 
  194. {
  195.     {
  196.     "OpCode",                        /* operation code            */
  197.     1,                                /* 1 byte                    */
  198.     "Block",                        /* LUN & logical block addr    */
  199.     3,                                /* 3 bytes                    */
  200.     "Length",                        /* transfer length            */
  201.     1,                                /* 1 byte                    */
  202.     "Ctrl",                            /* control byte                */
  203.     1                                /* 1 byte                    */
  204.     }
  205. };
  206.  
  207. resource 'STMP' (8, "10 Byte SCSI Cmd") 
  208. {
  209.     {
  210.     "OpCode",                        /* operation code            */
  211.     1,                                /* 1 byte                    */
  212.     "LUN",                            /* logical unit number        */
  213.     1,                                /* 1 byte                    */
  214.     "Block",                        /* logical block addr        */
  215.     4,                                /* 4 bytes                    */
  216.     "Reserv",                        /* reserved                    */    
  217.     1,                                /* 1 byte                    */
  218.     "Length",                        /* transfer length            */
  219.     2,                                /* 2 bytes                    */
  220.     "Ctrl",                            /* control byte                */
  221.     1                                /* 1 byte                    */
  222.     }
  223. };
  224.  
  225. resource 'STMP' (9, "12 Byte SCSI Cmd") 
  226. {
  227.     {
  228.     "OpCode",                        /* operation code            */
  229.     1,                                /* 1 byte                    */
  230.     "LUN",                            /* logical unit number        */
  231.     1,                                /* 1 byte                    */
  232.     "Block",                        /* logical block addr        */
  233.     4,                                /* 4 bytes                    */
  234.     "Reserv",                        /* reserved                    */    
  235.     3,                                /* 3 bytes                    */
  236.     "Length",                        /* transfer length            */
  237.     2,                                /* 2 bytes                    */
  238.     "Ctrl",                            /* control byte                */
  239.     1                                /* 1 byte                    */
  240.     }
  241. };
  242.  
  243. resource 'STMP' (10, "DCI") 
  244. {
  245.     {
  246.     "dcAddr",                        /* the buffer address or special opcode (dcLoop,dcStop)    */
  247.     4,                                /* 4 bytes                    */
  248.     "dCount",                        /* number of bytes to transfer (dcMove) or loop count    */
  249.     4,                                /* 4 bytes                    */
  250.     "dcOfst",                        /* buffer address offset (dcMove) or loop offset    */
  251.     4,                                /* 4 bytes                    */
  252.     "dcStor",                        /* reserved storage    (part of saved Data pointer)    */    
  253.     4,                                /* 4 bytes                    */
  254.     "Repeat",                        /* repeat the previous 4 fields */
  255.     0x00000004                        /* repeat until out of data */
  256.     }
  257. };
  258.  
  259. resource 'STMP' (11, "ParamBlock") 
  260. {
  261.     {
  262.     "QLink",                        /* link to next request block*/
  263.     4,                                /* 4 bytes                    */
  264.     "privat",                        /* private                    */
  265.     4,                                /* 2 bytes                    */
  266.     "Vers",                            /* param block version        */
  267.     2,                                /* 2 bytes                    */
  268.     "Result",                        /* result code                */    
  269.     2,                                /* 4 bytes                    */
  270.     "CmpRtn",                        /* address of completion routine*/
  271.     4,                                /* 4 bytes                    */
  272.     "Data",                            /* pointer to local storage    */
  273.     4,                                /* 4 bytes                    */
  274.     "ReqTO",                        /* request timeout, in ms    */
  275.     4,                                /* 2 bytes                    */
  276.     "UFlags",                        /* user flags                */
  277.     2,                                /* 4 bytes                    */
  278.     "SelTO",                        /* selection timeout, in ms    */
  279.     2,                                /* 1 byte                    */
  280.     "MFlags",                        /* scsi mgrs's flags        */
  281.     4,                                /* 1 byte                    */
  282.     "CLink",                        /* link to next command        */
  283.     4,                                /* 1 byte                    */
  284.     "Bus",                            /* bus number                */
  285.     1,                                /* 1 byte                    */
  286.     "scsiID",                        /* scsi device id            */
  287.     1,                                /* 2 bytes                    */
  288.     "LUN",                            /* logical unit number        */
  289.     1,                                /* 4 bytes                    */
  290.     "CmdLen",                        /* command buffer length    */
  291.     1,                                /* 4 bytes                    */
  292.     "CmdBuf",                        /* command buffer pointer    */
  293.     4,                                /* 4 bytes                    */
  294.     "DCIPtr",                        /* ptr to DCI buffer        */
  295.     4,                                /* 4 bytes                    */
  296.     "DatLen",                        /* requested data len        */
  297.     4,                                /* 4 bytes                    */
  298.     "DatXfr",                        /* actual bytes transferred    */
  299.     4,                                /* 1 byte                    */
  300.     "SnsBfr",                        /* ptr to sense data buffer    */
  301.     4,                                /* 1 byte                    */
  302.     "SnsLen",                        /* length of sense buffer (>=4)*/
  303.     1,                                /* 1 byte                    */
  304.     "SnsXfr",                        /* actual sense bytes recieved*/
  305.     1,                                /* 1 byte                    */
  306.     "Status",                        /* status byte from request    */
  307.     1,                                /* 4 bytes                    */
  308.     "filler",                        /* align to word            */
  309.     1                                /* 4 bytes                    */
  310.     }
  311. };
  312.  
  313. /* The rest of the templates are neither required or standard, you can
  314.    yank them and Sedit won't care */
  315. /* the following templates are for viewing scsi manager data structures */
  316. resource 'STMP' (12, "Driver Map") 
  317. {
  318.     {
  319.     "Sig",                            /* sbSig (sig word, $4552)    */
  320.     2,                                /* 2 bytes                    */
  321.     "BlkSiz",                        /* sbBlkSize                */
  322.     2,                                /* 2 bytes                    */
  323.     "BlkCnt",                        /* sbBlkCount                */
  324.     4,                                /* 4 bytes                    */
  325.     "DevTyp",                        /* sbDevType                */
  326.     2,                                /* 2 bytes                    */
  327.     "DevID",                        /* sbDevID                    */
  328.     2,                                /* 2 bytes                    */
  329.     "Data",                            /* sbData (reserved)        */
  330.     4,                                /* 4 bytes                    */
  331.     "DCount",                        /* sbDrvrCount                */
  332.     2,                                /* 2 bytes                    */
  333.     "Block",                        /* ddBlock                    */
  334.     4,                                /* 4 bytes                    */
  335.     "Size",                            /* ddSize                    */
  336.     2,                                /* 2 bytes                    */
  337.     "Type",                            /* ddType                    */
  338.     2,                                /* 2 bytes                    */
  339.     "Repeat",                        /* repeat the previous 3 fields */
  340.     0x00000003                        /* repeat until out of data */
  341.     }
  342. };
  343.  
  344. resource 'STMP' (13, "Old Part Map") 
  345. {
  346.     {
  347.     "Sig",                            /* pdSig (sig word, $5453)    */
  348.     2,                                /* 2 bytes                    */
  349.     "Start",                        /* pdStart                    */
  350.     4,                                /* 4 bytes                    */
  351.     "Size",                            /* pdSize                    */
  352.     4,                                /* 4 bytes                    */
  353.     "FSID",                            /* pdFSID (file sys ID)        */
  354.     4,                                /* 4 bytes                    */
  355.     "Repeat",                        /* repeat the previous 3 fields */
  356.     0x00000003                        /* repeat until out of data */
  357.     }
  358. };
  359.  
  360. resource 'STMP' (14, "New Part Map") 
  361. {
  362.     {
  363.     "Sig",                            /* pmSig (sig word, $504D)    */
  364.     2,                                /* 2 bytes                    */
  365.     "SigPad",                        /* pmSigPad (reserved)        */
  366.     2,                                /* 2 bytes                    */
  367.     "BlkCnt",                        /* pmMapBlkCnt                */
  368.     4,                                /* 4 bytes                    */
  369.     "PStart",                        /* pmPylPartStart            */
  370.     4,                                /* 4 bytes                    */
  371.     "BlkCnt",                        /* pmPartBlkCnt                */
  372.     4,                                /* 4 bytes                    */
  373.     "PName",                        /* pmPartName                */
  374.     16,                                /* 16 bytes                    */
  375.     "PName",                        /* pmPartName                */
  376.     16,                                /* second 16 bytes            */
  377.     "PType",                        /* pmPartType                */
  378.     16,                                /* 16 bytes                    */
  379.     "PType",                        /* pmPartType                */
  380.     16,                                /* second 16 bytes            */
  381.     "DStart",                        /* pmLgDataStart            */
  382.     4,                                /* 4 bytes                    */
  383.     "DatCnt",                        /* pmDataCnt                */
  384.     4,                                /* 4 bytes                    */
  385.     "Status",                        /* pmPartStatus                */
  386.     4,                                /* 4 bytes                    */
  387.     "BStart",                        /* pmLgBootStart            */
  388.     4,                                /* 4 bytes                    */
  389.     "BSize",                        /* pmBootSize                */
  390.     4,                                /* 4 bytes                    */
  391.     "BLoad",                        /* pmBootLoad                */
  392.     4,                                /* 4 bytes                    */
  393.     "BLoad2",                        /* pmPBootLoad2                */
  394.     4,                                /* 4 bytes                    */
  395.     "BEntry",                        /* pmBootEntry                */
  396.     4,                                /* 4 bytes                    */
  397.     "BEnty2",                        /* pmBootEntry2                */
  398.     4,                                /* 4 bytes                    */
  399.     "BCheck",                        /* pmBootCksum                */
  400.     4,                                /* 4 bytes                    */
  401.     "Proc",                            /* pmProcessor                */
  402.     16,                                /* 16 bytes                    */
  403.     "Data",                            /* boot specific arguments    */
  404.     16,                                /* 128 bytes                */
  405.     "Repeat",                        /* repeat the previous 1 field */
  406.     0x00080001                        /* repeat 8 times            */
  407.     }
  408. };
  409.  
  410. resource 'STMP' (15, "MDB") 
  411. {
  412.     {
  413.     "Sig",
  414.     2,
  415.     "CrDate",
  416.     4,
  417.     "LSMod",
  418.     4,
  419.     "Atrb",
  420.     2,
  421.     "NmFls",
  422.     2,
  423.     "VBMSt",
  424.     2,
  425.     "AllPtr",
  426.     2,
  427.     "NmABlk",
  428.     2,
  429.     "ABlkSz",
  430.     4,
  431.     "ClpSiz",
  432.     4,
  433.     "AlBlSt",
  434.     2,
  435.     "NxCNID",
  436.     4,
  437.     "FreBks",
  438.     2,
  439.     "VolNam",
  440.     16,
  441.     "VolNam",
  442.     12,
  443.     "VlBkUp",
  444.     4,
  445.     "SeqNum",
  446.     2,
  447.     "WrCnt",
  448.     4,
  449.     "XClpSz",
  450.     4,
  451.     "CClpSz",
  452.     4,
  453.     "RtDirs",
  454.     2,
  455.     "FilCnt",
  456.     4,
  457.     "DirCnt",
  458.     4,
  459.     "FndInf",
  460.     16,
  461.     "FndInf",
  462.     16,
  463.     "VCSize",
  464.     2,
  465.     "VCBM",
  466.     2,
  467.     "CtlCSz",
  468.     2,
  469.     "XTFlSz",
  470.     4,
  471.     "XTERec",
  472.     12,
  473.     "CTFlSz",
  474.     4,
  475.     "CTERec",
  476.     12
  477.     }
  478. };
  479.  
  480.  
  481. resource 'STMP' (16, "Boot Block") 
  482. {
  483.     {
  484.     "Sig",
  485.     2,
  486.     "EntyPt",
  487.     4,
  488.     "Vers",
  489.     2,
  490.     "PageFl",
  491.     2,
  492.     "System",
  493.     16,
  494.     "Finder",
  495.     16,
  496.     "MacBug",
  497.     16,
  498.     "DisAsm",
  499.     16,
  500.     "StScrn",
  501.     16,
  502.     "StApp",
  503.     16,
  504.     "ClipBd",
  505.     16,
  506.     "NumFCB",
  507.     2,
  508.     "NumEvt",
  509.     2,
  510.     "128K",
  511.     4,
  512.     "256K",
  513.     4,
  514.     "512K",
  515.     4,
  516.     "Addr",
  517.     16,
  518.     "Repeat",    
  519.     0x00000001    
  520.     }
  521. };
  522.